import store from '@/store/index';
var gettersData = store.getters;
export function setTextStyle(arr) {
  if (store.state.list.childItem.name === "DiyText") {
    // 设置字体样式
    setPubTextStyle(arr)
  }
}

// 设置公共字体样式
function setPubTextStyle(styleArr) {
  for (const i in styleArr) {
    switch (styleArr[i].id) {
      case 0:
        if (styleArr[i].status) {
          gettersData.listPageStyle.childStyle[0].style.textDecoration = "underline";
        } else {
          gettersData.listPageStyle.childStyle[0].style.textDecoration = "";
        }
        break;
      case 1:
        if (styleArr[i].status) {
          gettersData.listPageStyle.childStyle[0].style.fontStyle = "italic";
        } else {
          gettersData.listPageStyle.childStyle[0].style.fontStyle = "";
        }
        break;
      case 2:
        if (styleArr[i].status) {
          gettersData.listPageStyle.childStyle[0].style.fontWeight = "bold";
        } else {
          gettersData.listPageStyle.childStyle[0].style.fontWeight = "";
        }
        break;
      case 3:
        if (styleArr[i].status) {
          gettersData.listPageStyle.childStyle[0].style.textAlign = "left";
        } else {
          gettersData.listPageStyle.childStyle[0].style.textAlign = "";
        }
        break;
      case 4:
        if (styleArr[i].status) {
          gettersData.listPageStyle.childStyle[0].style.textAlign = "center";
        } else {
          gettersData.listPageStyle.childStyle[0].style.textAlign = "";
        }
        break;
      case 5:
        if (styleArr[i].status) {
          gettersData.listPageStyle.childStyle[0].style.textAlign = "right";
        } else {
          gettersData.listPageStyle.childStyle[0].style.textAlign = "";
        }
        break;
      default:
        break;
    }
  }
}
